﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{pageTitle}</title>
<link rel="stylesheet" type="text/css" href="template/default.css" />
<script src="js/jquery/jquery.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<script type="text/javascript">
function check(form)
{
	if(form.userid.value=="")
	{
		alert("Set an Id!");
		return false;
	}else if(form.username.value=="")
	{
		alert("Set a name!");
		return false;
	}else if(form.password.value!=form.password1.value)
	{
		alert("The passwords are not same!");
		return false;
	}
	return true;
}
function pDisplaySwitch(a)
{	
	a_s = document.getElementById(a).style.display;
	if(a_s == "" || a_s == "block"){
		document.getElementById(a).style.display = "none";
	} else if(a_s == "none"){
		document.getElementById(a).style.display = "";
		document.getElementById(a).style.display = "block";
	}
}
function show(a)
{	
	document.getElementById(a).style.display = "";
	document.getElementById(a).style.display = "block";
}
function hide(a)
{	
	document.getElementById(a).style.display = "none";
}
function submitRating(evt)
{
	var tmp = evt.target.getAttribute('id').substr(5);
	var ip = "{ip}";
	var uid = "{user_id}";
	var widgetId = tmp.substr(0, tmp.indexOf('_'));
	var ownerType = widgetId.substr(0,1);
	var ratingType = widgetId.substr(1,1);
	var ownerId =  widgetId.substr(2,widgetId.length - 2);
	var starNbr = Number(tmp.substr(tmp.indexOf('_')+1)) + 1;
	$.get("./rating_submit.php",
    	{
			ratingType: ratingType, 
			ownerType: ownerType,
			ownerId: ownerId, 
			ip: ip, 
			userId: uid,
			value: starNbr
		},
    	function(data){
			alert(data);
			if(data == "Thank you for rating!"){
				window.location.reload(true);
			}
		}
    );
}
function jqueryInit()
{
	init_rating();
	$('div.rating/img').bind('click', submitRating);
}
$(document).ready(jqueryInit);
</script>
</head>
<body>
{user_session}
<div id="container" style="visibility:{contentView}">
<div id="original_talk">{note}</div>
<h3>New talk</h3>
<form name="talkcontent" method=post action="talk_create.php" onsubmit="return check(this);">
<input type="hidden" name="ownerId" value="{ownerId}" />
<input type="hidden" name="talkType" value="{talkType}" />
<div id="talk_create">
	Author: [<a>{talk_author}</a>]<br/>
	<textarea name="content" cols="40" rows="6" id="talk_content"></textarea>
</div>
<input class="general_button" type="submit" value="Submit" />
<input class="general_button" type="button" value="Discard" onclick="window.history.back()" />
</form>
</div>
</body>
</html>